package com.fjec.gateway.controller;

import com.fjec.common.Const;
import com.fjec.common.enums.EnumSysCode;
import com.fjec.common.exception.BizException;
import com.fjec.common.protocol.JsonResult;
import com.fjec.common.shiro.AccountInfo;
import com.fjec.common.util.JsonUtil;
import com.fjec.common.util.SpringContextUtil;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

@RestController
@RequestMapping("/")
public class ZullController {

    @GetMapping("/un_auth")
    public void un_auth(HttpServletResponse response) throws Exception {
        throw new BizException(EnumSysCode.ERR_0005.getCode(), EnumSysCode.ERR_0005.getMsg());

    }

    @GetMapping("/unauthorized")
    public JsonResult unauthorized() {
        throw new BizException(EnumSysCode.ERR_0005.getCode(), EnumSysCode.ERR_0005.getMsg());
    }

    @GetMapping("/test")
    public String test() {
        return "ok!";
    }


    @PostMapping("/do/not/forget/me")
    public String doNotForgetMe() {
        Const.DO_NOT_FORGET_ME = true;
        return "ok!";
    }

}
